8. Proposals¶
8.1. Code Highlight¶
def some_function():
interesting = False
print 'This line is highlighted.'
print 'This one is not...'
print '...but this one is.'
1 2 3 4 5 | def some_function():
interesting = False
print 'This line is highlighted.'
print 'This one is not...'
print '...but this one is.'
|
with TemporaryFileHierarchy() as tmp_directory:
# change current working directory
os.chdir(tmp_directory)
print('curent directory is now:', os.getcwd())
abs_path = os.path.join(tmp_directory, 'subdir', 'file1') + '.txt'
pretty_print((
os.path.dirname(abs_path),
os.path.basename(abs_path), # ref 1
os.path.splitext(abs_path),
))
abs_path = os.path.join(tmp_directory, 'subdir', '..', 'file1')
pretty_print((
abs_path,
os.path.realpath(abs_path), # remove .. and symlinks
))
abs_path = os.path.join('.', 'subdir', 'file1')
pretty_print((
abs_path,
os.path.abspath(abs_path),
))
with TemporaryFileHierarchy() as tmp_directory:
# change current working directory
os.chdir(tmp_directory)
print('curent directory is now:', os.getcwd())
abs_path = os.path.join(tmp_directory, 'subdir', 'file1') + '.txt'
pretty_print((
os.path.dirname(abs_path),
os.path.basename(abs_path),# ref 1
os.path.splitext(abs_path),
))
abs_path = os.path.join(tmp_directory, 'subdir', '..', 'file1')
pretty_print((
abs_path,
os.path.realpath(abs_path), # remove .. and symlinks
))
abs_path = os.path.join('.', 'subdir', 'file1')
pretty_print((
abs_path,
os.path.abspath(abs_path),
))
8.2. Banner¶
foo