How to upload an HTML file into python? [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Im trying to write a python (2.7) program that can load a set of html files, search the files for certain variables and then extract the variables in json. Does anyone have an idea where to start, what commands or modules to import?

you might need beautifulsoup, this will help to parse the html.
You can open the html file using builtin python open funciton

Related

How can you use excel functions in python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 days ago.
Improve this question
I want to use excel function in python language. Are there any python libraries that allows you to use excel functions like convert and concatenate ?
I tried pyexcel and want more libraries like that.

Submit python script through PHP/AJAX [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I made a python script which can convert .MOV to .MP4. I want to execute the script from my website made on PHP.
So the example is I'm browsing a video on the web page then I click on submit and I'm waiting for the python script executing. It's working already but now I need to adapt it to my actual website and the session cookie (PHP).
But I don't know how to do that. I saw on some forum that they use Flask or Django but my website is already built and I don't want to rebuilt it.

How to save variable into a file (like print but into file)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am asking how to save a text file in python, that can contain a variable.
I didn't tried anything because I am a beginner.
Let's say you have a file called file and it is a notepad (text/txt) document. Your code would go like this:
text = "This can be anything"
with open("file.txt", "w") as myfile:
myfile.write(text)
The tutorial on reading and writing files should help if you don't understand this. The w means that you can write to the file.

How to delete a file without specifying its extension? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I've got files uploaded in a server, whose filenames are their id they have in my mongo database.
I've got a process that converts files from pdf to txt.
So, I want to delete the specified file without indicating it's extension.
Up to now, my code is as follows:
os.remove(os.path.join(app.config['UPLOAD_FOLDER'], str(document["_id"]) + ".txt"))
You can use glob to search folders with wildcards.
doc = str(document[“_id”])
glob.glob(‘{}.*’.format(doc))

Create a package python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I've created a TAR with some xml and classes, In another server i need to put those files in various directories, something like an installable, is possible?
Using CentOS
Thanks
You can easily just have a package.format and a python script that extracts from that format and moves the files to relative locations or an absolute location if you know that. Is that what you're looking for?
You can use zipfile for the extracting/compressing and shutil and os to move/delete/modify the files.

Categories

Resources