1 | initial version |
Note that open()
is a Python function that can open any kind of file. The main issue is then to handle your file so that the data can be used in Sage (i.e. transformed into Sage objects).
Since Sage is written in Python, there are many modules to handle many particular types of file (e.g. if you want to open an xml file, you can imort and use the xml
module, if you want to open a gpg file, you can install, import and use the gnupg
module, and so on). If your file is an ad-hoc text file, you can use various python tools to get interesting data from it (e.g. use the string methods, consider also the re
module allows you to filter your file with regular expressions).
So this really depends on your situation. The data from which sotware do you want to deal with ? Which formats does it allow to export ?
2 | No.2 Revision |
Note that open()
is a Python function that can open any kind of file. The main issue is then to handle your file so that the data can be used in Sage (i.e. transformed into Sage objects).
Since Sage is written in Python, there are many modules to handle many particular types of file (e.g. if you want to open handle an xml file, you can imort and use the xml
module, if you want to open handle a gpg file, you can install, import and use the gnupg
module, and so on). If your file is an ad-hoc (non-standard) text file, you can use various python tools to get interesting data from it (e.g. use the string methods, consider also the re
module allows you to filter your file with regular expressions).
So this really depends on your situation. The data from which sotware do you want to deal with ? Which formats does it allow to export ?