Function to export *.comm files #65
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "JakHolzer-comm_exprt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: JakHolzer
Created by: ivan-usov
Here it's important to use context manager (the 'with' statement), otherwise, in case of exception the file won't be closed.
Something like that will look better:
The line
out_file.close()
is not needed.Created by: ivan-usov
These lines should be removed, while
path
andname
should become a function argument (probably, a single one).Created by: JakHolzer
Deleted, changed to path argument which should be str(path+name) - or wold you rather pass it as a touple?
Created by: JakHolzer
done :)
Created by: ivan-usov
You can use
str.rjust
function instead (https://docs.python.org/3/library/stdtypes.html#str.rjust)Created by: ivan-usov
In fact, there are similar padding options in
str.format()
function. Basically, all of the following have similar output:But I would also suggest you to have a look at f-strings, which appeared in python/3.6. They could be even easier to use in this case.
Created by: ivan-usov
This code needs to be deduplicated.
Or something like that, probably the final form will be different depending on the approach you choose with the string interpolation.
Created by: JakHolzer
I deduplicated the code and used the fstrings to do the padding
Created by: ivan-usov
Review: Approved
Merged by: ivan-usov at 2020-09-15 12:24:34 UTC