Python Forum

Full Version: Insert scrypt inside file.py ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
JohnnyCoffee Wrote:How do I insert any python script into file2.py ?
You can do
from pathlib import Path

Path('file2.py').write_text(
"""
print("hello world, I'm file2.py")
""")
(Oct-06-2019, 08:13 PM)Gribouillis Wrote: [ -> ]
JohnnyCoffee Wrote:How do I insert any python script into file2.py ?
You can do
 from pathlib import Path Path('file2.py').write_text( """ print("hello world, I'm file2.py") """) 
Thanks.
Pages: 1 2