如何在外部终端上 运行 文件?
How can I run files on external terminal?
我试图在 Python 中制作一个生成随机密码的程序,我想 运行 在 Windows 终端而不是 [=16] 的内部终端上运行这个程序=]代码.
这是代码:
import random
lunghezza = int(input("inserisci la lunghezza della password")) # insert password lenght
s = "abcdefghijklmnopqestuvwxyz1234567890"
p = "".join(random.sample(s, lunghezza))
# lunghezza means lenght
print(p)
要在终端中执行 Python 文件,您有多种选择:
1-如果您在 Windows:python MyPythonFile.py
2-如果您在 Linux:python3 MyPythonFile.py
如果要使用python2.x,则需要使用python2 MyPythonFile.py
,如果使用Linux
打开 Windows 终端,导航到文件目录(您可以在 visual studio 的终端中输入 pwd 找到它)并执行文件输入:
python yourfilename.py
或
python3 yourfilename.py
我试图在 Python 中制作一个生成随机密码的程序,我想 运行 在 Windows 终端而不是 [=16] 的内部终端上运行这个程序=]代码.
这是代码:
import random
lunghezza = int(input("inserisci la lunghezza della password")) # insert password lenght
s = "abcdefghijklmnopqestuvwxyz1234567890"
p = "".join(random.sample(s, lunghezza))
# lunghezza means lenght
print(p)
要在终端中执行 Python 文件,您有多种选择:
1-如果您在 Windows:python MyPythonFile.py
2-如果您在 Linux:python3 MyPythonFile.py
如果要使用python2.x,则需要使用python2 MyPythonFile.py
,如果使用Linux
打开 Windows 终端,导航到文件目录(您可以在 visual studio 的终端中输入 pwd 找到它)并执行文件输入:
python yourfilename.py
或
python3 yourfilename.py