Skip to content

Instantly share code, notes, and snippets.

@santosadrian
Created February 3, 2020 12:05
Show Gist options
  • Save santosadrian/1ca0eb67a151cfaf97599aa64ff3ec14 to your computer and use it in GitHub Desktop.
Save santosadrian/1ca0eb67a151cfaf97599aa64ff3ec14 to your computer and use it in GitHub Desktop.
Example 15
from sys import argv# Imports module argv from library sys
script, filename = argv# get and set script and filename variables from user input
txt = open(filename)# set variable txt with a function
print(f"Here's your file {filename}") # This prints a sentence and a variable print(f"bla {variable"}
print(txt.read()) # this print a call to a variable that consist in a function
print("Type the filename again:") # print a string
file_again = input("> ") # defines a variable file_again that gets the value from user input
txt_again = open(file_again) # defines the variable txt_again to a function or method
print(txt_again.read()) # prints in screen a variable that is a function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment