[Tutor] how to convert list of lists to dict

2011-05-17 Thread Brad Hudson
I'm new to python and have a need to convert a 'list of lists' to a dictionary object. Can someone help me to convert data similar to the following using two different examples of a list comprehension and a for loop? Data is similar to the following: [['name=server1', 'state=active', 'ncpu=8', 'me

Re: [Tutor] how to convert list of lists to dict

2011-05-17 Thread Brad Hudson
On Tue, May 17, 2011 at 11:30 AM, Emile van Sebille wrote: > On 5/17/2011 8:58 AM Brad Hudson said... > > I'm new to python and have a need to convert a 'list of lists' to a >> dictionary object. Can someone help me to convert data similar to the >> followi

Re: [Tutor] how to convert list of lists to dict

2011-05-17 Thread Brad Hudson
On Tue, May 17, 2011 at 12:10 PM, Alan Gauld wrote: > > Given that you want more than one method I assume > this is a homwework assignment rather than a practical > problem? If so we would prefer that you showed us what > you tried and we can then help you fix it rather than > just offer you solut

[Tutor] Python Database Scripting

2012-02-08 Thread Brad Hudson
Can someone provide information on the best modules/python tools to use for general database scripting? I'm interested in something that works across the board for Oracle, MySQL, MS SQL Server, and DB2. I was hoping a good generic ODBC module would be out there, but I'm having difficulty locating o

Re: [Tutor] Python Database Scripting

2012-02-08 Thread Brad Hudson
Thanks for the responses Alan & Modulok. I will start with SQLAlchemy and see where it takes me. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] python + sharepoint

2012-03-02 Thread Brad Hudson
Can someone assist in a very basic task of retrieving a '.txt' file from a sharepoint document library using Python 2.4 standard libraries? I'm certain, I need to build up some form of authentication to pass, but do not know where to begin. Also, I do not want to attempt to customize or install add

Re: [Tutor] python + sharepoint

2012-03-02 Thread Brad Hudson
On Fri, Mar 2, 2012 at 11:03 AM, Brad Hudson wrote: > Can someone assist in a very basic task of retrieving a '.txt' file > from a sharepoint document library using Python 2.4 standard > libraries? I'm certain, I need to build up some form of authentication > to pas

Re: [Tutor] New to Python programing

2012-04-03 Thread Brad Hudson
>> Are you possibly thinking of the Khan Academy [1] ? >> >> [1] http://www.khanacademy.org/ If you're interested in free courses, MIT also has free programming courses (done in Python) via their OpenCourseWare and will be expanding this to MITx in the near future. OpenCourseWare - Intro to Compu

[Tutor] How to create self contained Windows executables (.exe files) from python scripts

2012-05-17 Thread Brad Hudson
Can someone point me to information on how to create Windows .exe files from python 2.7.3? The py2exe method (www.py2exe.org) appears to only be available for python 2.6 from the sites I've seen. Thanks in advance. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Optimally configuring Emacs for W7-64bit and Python

2012-05-22 Thread Brad Hudson
Aside from emacs, vim is a nice editor that can be used across UNIX/Linux/Windows OS. It is also more friendly to learn/configure than emacs (install it, type "vim" at a shell/cmd.exe prompt and use the help that comes with it for customization). It comes by default on most modern UNIX/Linux OS. Si

Re: [Tutor] Notepad++ question

2012-06-07 Thread Brad Hudson
I don't use notepad or notepad++, so I don't know the settings. However, if you're familiar with vi/vim, you can download the CLI from www.vim.org for almost any flavor OS and it works quite well on Windows. BTW: you can customize your settings to use spaces instead of tabs, among others, which is

Re: [Tutor] Counting Items in a List

2012-06-20 Thread Brad Hudson
I think this is more of what you ar looking for: >>> a = 'this is a list with is repeated twice.' >>> a 'this is a list with is repeated twice.' >>> alist = a.strip().split() >>> alist ['this', 'is', 'a', 'list', 'with', 'is', 'repeated', 'twice.'] >>> var='is' >>> alist.count(var) 2 >>> On Wed,

Re: [Tutor] ssh connection

2012-12-17 Thread Brad Hudson
Look at the subprocess module. You can send your SSH connections via subprocess and collect the output for parsing. On Mon, Dec 17, 2012 at 7:40 AM, Ufuk Eskici wrote: > Hello All, > > Can we make an SSH connection with Pyhton 3.3 ? > > I want to connecto to my router, send commands and receive

Re: [Tutor] Problem with os.system

2013-03-01 Thread Brad Hudson
> #!/usr/bin/env python > > import os > > global name_wo_ext > > name_wo_ext = "d:\\fun" > > os.system("mkdir %s" % (name_wo_ext)) > > > > This gets executed well but there is no directory created L I tried with > another command as below and it works for me > This is not a problem with os.system.

Re: [Tutor] Reversed dictionary returned by default

2013-03-01 Thread Brad Hudson
> I am getting the following for my installation. > > Why is this happening, and how do I get it to work properly (returning > element 0 - n, versus n - 0)? > > Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on > win32 > Type "help", "copyright", "credits" or "license" fo

Re: [Tutor] Problem with os.system

2013-03-04 Thread Brad Hudson
> I have given the admin privileges for my drive but still os.system won't > work :( > Are you saying you applied "Administrator" privileges to the drive/folder? If so, are you executing your script as a normal user or as "Administrator"? Example: In order to run something from the command prompt a