HI I am new managing excel files, I would like to know if there is any variable in xlutils, xlrd, xlm, etc libraries that give true or false in case Macros are activated or now? Is there any way to know it from metadata before open? Wat is the best approach for know it?
Thanks a lot in advance.
It's technically possible but very unlikely that Excel is calling any Python functions.
A quick Google Search shows lots of people asking if VBA can use Python, and a few theoretical responses, but nothing solid.
What I would do to confirm, is move all the "mystery python scripts" to another folder. If someone complains that things suddenly don't work any more, then move them back.
If a couple months pass and everything's still working properly, it's unlikely that anyone needs them.
Edit:
Figures... as I was writing that answer someone posted a VBA/Python question!
...but out of curiousity, I queried SE Data Explorer:
Questions with tags like %vba% or %excel%: 212,299
Questions with tags like %python% and (%vba% or %excel%): 5,808 (2.7%)
Related
I currently have a quite big program written in FoxPro (prg file). Now FoxPro is actually really getting outdated, so what I want to ask is the following:
Is it possible to convert all the FoxPro code (.prg file) to Python? Is there a simple trick/code for this? Python has to become my main coding platform, so I don't need to use FoxPro anymore for when I want to adjust some code or something else. Does someone have experience with this?
I hope to hear from you, appreciate your help.
PS: Please note that I am quite new to Python.
There are plenty of people from the FoxPro community who migrated into the Python world certainly, but there are no tools that I know of for converting source code. As with most of these 'can I convert from language x to language y' questions, you would spend more time getting the result into shape than you would just documenting and rewriting.
There are some Python scripts that implement common Visual FoxPro functions in the download section on Leafe.com which might help.
You might want to check out this question.
There is also vfp2py.
Python comes with support for excellent SQLite database built-in with the sqlite3 module. (You are probably aready using sqlite, but you might not even know it.) Storing the data in an sqlite database means you will not have to worry about not being able to access it for the rest of your life.
just started working on my quiz application using python and it has to do with maths(True-False) questions.So whenever i try to copy-paste a question from the internet to my questions array some characters are really messed up.Can anyone help me solve this please? i have searched a lot for a solution but didn't get an answer so far.(I am using Pycharm)
Sometimes there are space/tab conversion errors that occur when copy/pasting from a web source.
If that is the problem you're having in pycharm, just highlight the code that was copied > Edit > Convert Indents.
If this is not what you needed, please edit your question to include the code block containing the "really messed up characters" that you are seeing in pycharm. I'll try to see what's happening there.
Is there a way to save the current Python session? I would like to be able to save all my Python variables, functions, and imported libraries. If possible, having the history saved would be nice. I have looked all over Google and Stackoverflow for a simple command to do this, but have found nothing quite fitting what I want. Some suggested downloading new software, which I don't want. Others had big scripts that they wrote to do this for them.
I'm looking for a no-nonsense easy to use command. Is there one? If not, how would you suggest to make one?
UPDATE: readline.write_history_file() and readline.read_history_file() save the history.
I think the closest thing you're going to find is ipython. I'm not sure if it does the variable saving thing, but I believe it does everything else you're asking for.
1.) After typing all commands just do CTRL+S.
2) Give a file name and say OK.
This works for Python Shell.
This question may sounds dumb, but I can't manage to find a correct answer on my own.
I am trying to use the SVG DOM interface in my python script. I would like to use getComputedTextLength but I can't find how even if I firstly thought it would be available thanks to modules or a packages like python-svg or something like that.
I am sure there is something I miss, but I can't find what.
Any help would be appreciated.
Thank you.
EDIT: I forgot to talk about what my script actually does. It's a Python script used to generate a SVG file from data grabbed on the Internet. My script needs to write texts and repeat them all along a path. Also, as I know the exact length (in pixels) of the path I need to know the length of the text in order to repeat it only what I need to. That's why a method like getComputedTextLength would be helpful.
Try this: http://www.gnu.org/software/pythonwebkit/
I don't think this is possible. DOM is one thing and calling browser's function is other thing. I only saw Python module which help you to create tree structures like HTML or SVG but they don't provide any other additional functionality. (Btw., last time I look even browsers had problems correctly computing getComputedTextLength but that was some time ago...)
You could try better luck with fonttools.
I have an executable (converted to exe from python using py2exe) that outputs lists of numbers that could be from 0-50K lines long or a little bit more.
While developing, I just saved them to a TXT file using simple f.write.
The person wants to print this output on paper! (don't ask why lol)
So, I'm wondering if I can output it to something like HTML? XML? Something that could display tables of 50K lines and maybe 3 columns and that would also run in any PC without additional programs?
Suggestions?
EDIT:
Regarding CSV:
In most situations the best way in my opinion would be to make a CSV. I'm not opposing it in anyway, rather I think others might find Lott's answer useful for their cases. Sorry I didn't explain it that well in my question as far as my constraints go.
My constraints are: the user doesn't have an office suite, no python installed. Just think of a PC that has the bare minimum after a clean windows xp/vista installation, maybe Internet Explorer 7 or 8. This PC has to be able to open my output file and allow for reasonable viewing, searching, and printing.
CSV.
http://docs.python.org/library/csv.html
http://en.wikipedia.org/wiki/Comma-separated_values
They can load a spreadsheet and print anything they want.
If you can't install anything on the computer, the you might be best off outputting an HTML file with the data in a <table> that the user could view/search/print in IE.
You could use LaTeX to produce a PDF, maybe? But why exactly isn't a text file good enough?
You can produce a PDF using Reportlab. After all if you really want full control of the printed output, there's nothing that beats PDF.
Does 50k lines make too large a file? If not, just continue writing text files. Otherwise an easy solution would be to continue spitting out text files and compress them, e.g. with zip. You could use the zipfile library in Python. Most computers have no trouble reading zip files.