In python you can import multiple libraries at once and also you can import a specific function from a library like below:
import sys, os, csv
from shutil import copyfile
Is there a way to combine this?
For example, like this:
import sys, os, csv, from shutil import copyfile
Note, i'm aware that we can use
shutil.copyfile, but I would like to usecopyFilewithoutshutil
CodePudding user response:
If you NEED it in one line, you could use a semicolon
Such as:
import sys, os, csv; from shutil import copyfile
CodePudding user response:
You can use ;to add multiple statements in single lines in Python
import sys, os, csv; from shutil import copyfile
CodePudding user response:
If you really want to combine the imports in one line, you can do this :
import sys, os, csv; from shutil import copyfile
Just change de "," anfter csv to ";"
However, it is not recommended to do this.
