Writing text Files using Print function !

babywriting.jpg (700×420) (netdna-cdn.com)

Print Function Syntax

print(object(s), sep=separator, end=end, file=file, flush=flush)
  1. Objects
print( “Learning print function”, 2, 2.789, 0+0J )OUTPUTLearning print function 2 2.789 0j
print( "Learning","print","function" ) # sep=""print( “Learning”, “print”, “function” , sep=”-” )OUTPUTLearning print function
Learning-print-function
print(“first”) 
print()
print(“second”)
print("Learning", end = ' something ')
print("with print")
OUTPUTfirstsecond
Learning something with print
sourceFile = open(‘my_file.txt’, ‘w’)print(‘Pretty cool, huh!’, file = sourceFile)sourceFile.close()

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store