Hi guys I was making a little script that makes a .txt and then records the information and uploads on a cloud or my pc for a quiz. I was wondering if someone could help me by showing me how to make that .txt upload onto my med iaf re or d ropb ox, etc...
OR if that isnt possible have it directly upload to my pc.
Using Python btw
With php you can use the fopen() function to write data to a document. I think it's pretty similar in python aswell.
example code:
f = open("yourfile.txt", "w") # yourfile.txt = the document you want to write to, "w" tells python to write
f.write("hello") # text to write
f.close() # close
hope this helped ya, not entirely sure if that code will work but give it a try.
Originally Posted by griimnak
With php you can use the fopen() function to write data to a document. I think it's pretty similar in python aswell.
example code:
hope this helped ya, not entirely sure if that code will work but give it a try.
I know how to write a file, but I needed it to go onto a website or online. Something in that concern. But Thanks!
Originally Posted by Ffrocks3
I know how to write a file, but I needed it to go onto a website or online. Something in that concern. But Thanks!
Ah I see, so maybe sending it to your gmail account? that can be done with smtp connection:
Code:
import smtplib as server
connect = server.SMTP("smtp.gmail.com:587")
connect.starttls()
connect.login('usernamehere', 'passwordhere')
connect.sendmail('usernamehere', 'targetemail', and here you can write the contents of your txt as the message)
Originally Posted by griimnak
Ah I see, so maybe sending it to your gmail account? that can be done with smtp connection:
Code:
import smtplib as server
connect = server.SMTP("smtp.gmail.com:587")
connect.starttls()
connect.login('usernamehere', 'passwordhere')
connect.sendmail('usernamehere', 'targetemail', and here you can write the contents of your txt as the message)
So would I be able to set this up so it auto sends to my gmail from the .txt file it's creating? Like when the; lets say "quiz" is done it will send to it?
Because currently it gets the answers and then makes a .txt in the folder the file is in. Then I wanted it to send.
Originally Posted by Ffrocks3
So would I be able to set this up so it auto sends to my gmail from the .txt file it's creating? Like when the; lets say "quiz" is done it will send to it?
Because currently it gets the answers and then makes a .txt in the folder the file is in. Then I wanted it to send.
mmm, not exactly sure but you could set a python timer so it uploads every x minutes/seconds/hours.
Give it a google bro i'm sure you'll find some usefull info, cheers
Originally Posted by griimnak
mmm, not exactly sure but you could set a python timer so it uploads every x minutes/seconds/hours.
Give it a google bro i'm sure you'll find some usefull info, cheers
Yea I can do that, Thanks Man! +rep appreciate it.
Originally Posted by Ffrocks3
Yea I can do that, Thanks Man! +rep appreciate it.