small white has just started to learn python have some problems, not search on the net to question the answer to the great god
question 1
Print (" 1, t2, t3 ")
Print (" 10 \ t20 \ t30 ")
the above code, I can run in the shell output aligned three column of figures
But to reach this alignment in Pycharm effect, is this why?
question 2
Abb. # p y
Print (12)
Def multiple_num (num1, num2) :
Print (num1 * num2)
Def say_hello () :
Print (" hello hello ")
# acc. Py
The import abb
Abb. Multiple_num (1, 2)
I want to be in the acc. Py the file reference in abb. A function of p y
But the import in addition to the calling function, also the abb. Other contents in the py import and in an output, such as the above print (12)
Don't excuse me is there a way to import these unwanted content?
CodePudding user response:
The first question I am not very clear, the second question is can answer you, you should refer to abb. PyIn a function, you can write that abb. Py files,
# abb. Py
Print (12)
Def multiple_num (num1, num2) :
Print (num1 * num2)
Def say_hello () :
Print (" hello hello ")
If '__name__=="__main__' :
Multiple_num (num1, num2)
Say_hello ()
Abb. In this way, you can either run separately py, abb. And you can call the function in the py,