![]() |
|
Re: ** Python Support Thread **
Quote:
Yes, parameters is a string and I want to call a function by that name. If I use eval, it either says the syntax is wrong or the there is no module eval defined. :\ |
Re: ** Python Support Thread **
sorry, I forgot to mention I was using the same 'f' from last post. Try this in an interpreter:
Code:
eval('sum')((1,2,3)) |
Re: ** Python Support Thread **
Why is this syntax invalid then? :\
scipy.stats.(eval('norm')).rvs() which is normally scipy.stats.norm.rvs() Edit: Is it because 'norm' is not directly a function after all? |
Re: ** Python Support Thread **
Hrm. Yeah, that exact syntax won't work. This does work, however:
Code:
scipy.stats.__dict__['norm'].rvs() |
Re: ** Python Support Thread **
Thanks. Both method works.
|
Re: ** Python Support Thread **
Is there a quick way to join two files on a common field(s)? Similar to UNIX join.
Only way I'm aware of is to use a nested loop, which I'd rather avoid. |
Re: ** Python Support Thread **
There is a way to run unix commands in a script.
|
Re: ** Python Support Thread **
|
Re: ** Python Support Thread **
Probably, I'm on the couch with my iPad so didn't do more than give a Google trail to start on...
|
Re: ** Python Support Thread **
os.system or subprocess will definitely be my last resort, but I'm hoping to use something that is purely python
|
Re: ** Python Support Thread **
Quote:
edit: pandas (nice library for handling data sets) can do this to I think. |
Re: ** Python Support Thread **
Couldn't you just read them in one at a time and write them to the same output file?
|
Quote:
Thanks |
Quote:
Code:
for line in open("file1): |
Re: ** Python Support Thread **
Quote:
Code:
import sqlite3http://stackoverflow.com/questions/2...e-using-python |
Quote:
|
Re: ** Python Support Thread **
For making very colorful forum posts.
Code:
import random |
Re: ** Python Support Thread **
I'm trying to learn some python and I wanted for python to interact with excel using the win32 module. I found a basic example online on wiki.(http://www.pha.com.au/kb/index.php/Python_COM_Examples)
It won't work however. This is the error I get. Traceback (most recent call last): File "C:/Users/Greg/Desktop/python programming/excel2.py", line 8, in sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter)) NameError: name 'Application' is not defined My question is what does that line DO EXACTLY and why am I getting an error? sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter)) import win32com.client from win32com.client import constants as c excel = win32com.client.Dispatch("Excel.Application") book = excel.Workbooks.Add() sheet = book.Worksheets(1) sheet.Range("A1").Value = "Hello World!" sheet.Range("A2").Value = str(Application.SIFilter(None, c.siObjectFilter)) book.SaveAs("c:\simple_example.xls") sheet = None book = None excel.Quit() excel = None Thanks I feel like such a noob, but alas I am a huge noob. |
Re: ** Python Support Thread **
Application is has not been defined as anything. I suspect that Application is a class within the library and you need to explicitly import it like you did with constants.
|
Re: ** Python Support Thread **
Hi, I just started taking the MIT open courseware class online today, and the second assignment has already got me stumped.
I know how to tell if a number is odd or not, but how do I generate it as a candidate? [Hints would be nice - but please not the flat out answer, I want to try and figure a little out for myself] Thanks in advance! |
Re: ** Python Support Thread **
Quote:
Think about this step: You simply want to print a column of numbers that are odd, right? 1 3 5 7 9 11 ... Think about the unique feature of integers that would make generating that list easy. You have the following steps: initialize a variable. What variable would allow you to take advantage of the unique feature alluded to? generate the list: What would you do to that initial variable that reflects the unique feature alluded to? See how I wrote down what you wanted to do? That class says using a pencil and paper is an important step in programming and I absolutely agree with that assertion. Writing down the output you want to see will help you see things that you may not have noticed before. If you really do give up, then use the spoiler tag: Try to fill in the blanks: Spoiler:
|
Re: ** Python Support Thread **
Quote:
I took a few classes of the intro to comp sci course at MIT, and at times the homework was mildly frustrating as I didn't fully grasp the concepts presented in class (this may have been because my schedule rarely allows me to sit down for the full 40-60 minutes for lecture - so I watched it in bits and pieces). I've only gone through 3 units of the Intro class on Udacity, but it's been much more enjoyable and I feel I understand the concepts far better than with MIT. |
Re: ** Python Support Thread **
I'm on the 3rd unit of the Web Engineering class at Udacity (which uses Python for the server side) and that class is also excellent so far.
|
Re: ** Python Support Thread **
i haven't taken either class but be aware of the difference between learning python/"web engineering" and computer science.
|
Re: ** Python Support Thread **
Quote:
|
| All times are GMT -4. The time now is 06:18 PM. |
|
Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 2008-2020, Two Plus Two Interactive