简体   繁体   English

如何使用cmd从头开始创建新的文本文档并将其另存为.py文件?

[英]How to create a new text document from scratch and save it as .py file using cmd?

Without considering an option to open a notepad first and saving it with the extension ".py" , how to create a new ".py" file in a corresponding directory using cmd ? 在不考虑先打开记事本并使用扩展名“ .py”保存的选项的情况下,如何使用cmd在相应目录中创建新的“ .py”文件?

Note : As a beginner python learner I request you to kindly ignore if this was a silly question ... 注意:作为一个Python初学者,我请您忽略这是否是一个愚蠢的问题...

on windows: C:\\Users\\username\\Desktop> echo "the script" > hello_world.py 在Windows上:C:\\ Users \\ username \\ Desktop> echo“ the script”> hello_world.py

Note: replace the username with your actual user account. 注意:用您的实际用户帐户替换用户名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从头开始创建一个新的 Spacy 3.0 项目? - How to create a new Spacy 3.0 project from scratch? 如何使用python将本地html文件中的信息保存在文本文档中? - how to save info from local html file in a text document with python? 如何从 txt 文档中获取文本并创建新目录? - How to take text from a txt document and create a new directory? 如何使用 Python 创建一个新的文本文件 - How to create a new text file using Python 如何将文本从ctl文件垂直连接到水平,然后使用python保存到新的ctl文件中? - How to concatenate the text from ctl file vertically to horizontally and then save in a new ctl file using python? 如何通过另一个脚本python将cmd输出保存到文本文件 - How to save cmd output to text file through another script python 如何使用 python 从头开始编写 Midi 文件 - How to write Midi File from scratch using python 如何从 .py 文件创建 .exe 文件 - How to create a .exe file from a .py file 在一个文本文件上执行脚本,并在没有 cmd 的情况下创建具有输出的新文本文件 - Execute script on one text file, and create new text file with output without cmd 我应该如何“在Game.py中保存所有控制台输出并将它们写入新的文本文件”? - How should I 'save all console outputs throughout my Game.py and write them to a new text file'?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM