https://search.twitter.com/search.json?q=doug
How do I read this like VIEW SOURCE, so that I know what I'm looking at?
Is there a website that can prettify it for me?
BTW, I use python
Python newb here. I m trying to count the number of letter "a"s in a given string. Code is below. It keeps returning 1 instead 3 in string "banana". Any input appreciated.
def count_letters(word, char):
count = 0
while count <= len(word):
for char in word:
if char == word[count]:
count += 1
return count
print count_letters('banana','a')
Hi,
I'm a college student majoring in computer science. I know java and will be learning C++ the next couple years at school. I want to add another language to my repertoire and have gotten conflicting advice: Ruby, Python, Perl, JavaScript, PHP, AJAX, among others.
I was wondering what everyone's opinions were on the relative value of each of these languages in the job market, the ease of learning of each of the languages, and just personal preferences when it comes to the languages mentioned above.
Thanks!
Hello everyone. I am working on a project that plays audio for part of the program. I would like to be able to display a message if the user's system volume is muted. I am using Python on Windows.
For example in Java for Data Transfer Object I use as:
ExampleDTO exampleDTO = new ExampleDTO();
What naming convention should I follow for similar in Python?
I want to learn C++ so that i can develop C++ Python modules for server-related stuff.
I'm a purely dynamic languages developer (Python, PHP, Ruby, etc). I want to learn a fast language, and if I'm going to do this, I'd rather learn a really fast language like C++. Before I even get started though, I understand that suddenly working with static types, a different syntax, and compiling code will be quite the paradigm shift. Is there any advice that a C++ dev who also has dynamic languages experience can give me to me to help me make that shift faster?
I have multiple Network Interface Cards on my computer, each with its own IP address.
When I use gethostbyname(gethostname()) from Python's (built-in) socket module, it will only return one of them. How do I get the others?
I know about the LEGB rule. But a simple test of whether a function has read access to variables defined in an enclosing function doesn't seem to actually work. Ie:
#!/usr/bin/env python2.4
'''Simple test of Python scoping rules'''
def myfunction():
print 'Hope this works: '+myvariable
def enclosing():
myvariable = 'ooh this worked'
myfunction()
if __name__ == '__main__':
enclosing()
Returns:
NameError: global name 'myvariable' is not defined
Am I doing something wrong? Is there more to it than the LEGB resolution order?
Recently came across pidgin. Its great, and does what I want, but I am not too keen on the GPL license. Other any alternatives, with less restrictive licenses?
I would prefer the library to be C or C++, as I am most familiar with those languages, but a an IM library implemented in python would be interesting too.
I have some structure in Python:
gender=( ('0','woman'), ('1','man') )
I want translate it before I will display it in Django template.
Unfortunatelly below sollution don't work:
from django.utils.translation import
ugettext_lazy as _
gender=( ('0',('woman')),
('1',('man')) )
What I must do to translate this.
I readed something in:
link text
but I can't understand what I should do.
As an ASP.NET developer, I'm used to working with how VS/C# transparently autogens proxy classes for web references (yes, I know, we're spoiled), but now that I'm creating documentation for more than one coding platform I'm trying to discover what the equivelant to that is in any other framework.
So is there a similar way to work transparently with web reference proxy classes for say, RoR, PHP, and Python?
And if there's nothing integrated, are there tools you recommend to autogen the proxy classes, or do you recommend to roll custom classes?
i try to write this code to process Arabic language by python
import codecs
file = codecs.open("C:\Python27\CCA_raw_utf8.txt","r","utf-8")
text= file.read()
####################################
print "\n "," --------------------------------------------"
text=text[1:]
words=text.split()
for w in words:
if w == unicode ("?????","utf-8"):
print w
but it doesn't and take error " if w == unicode ("?????","utf-8"):
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte "
why program gives this result and how we can correct that??
My input string is '16-MAR-2010 03:37:04' and i want to store it as datetime.
I am trying to use:
db_inst.HB_Create_Ship_Date = datetime.strptime(fields[7]," %d-%b-%Y %H:%M:%S ")
fields[7] = '16-MAR-2010 03:37:04'
I am getting an error:
::ValueError: time data '16-MAR-2010 03:37:04' does not match format ' %d-%b-%Y %H:%M:%S '
I am running Python version --EDIT-ME-- on the --EDIT-ME-- operating system.
My locale is --EDIT-ME--.
Which format do I have to use?
Hi everyone. I'd ideally like a vim answer to this:
I want to change
[*, 1, *, *] to [*, 2, *, *]
Here the stars refer to individual characters in the substring, which I would like to keep unchanged. For example
[0, 1, 0, 1] to [0, 2, 0, 1]
[1, 1, 1, 1] to [1, 2, 1, 1]
If people know how to do this in perl or python or whatever, that would be equally good.
Cheers
i want my thread to sleep when a queue is empty and just wake up when a data is put in it,
should i use condition object? i have never used this object before! and i can,t find a simple example in python
With python inotifyx, do I have to remove watch and close opened system file descriptor if I need them until program exit? E.g. is there some possible problems if I create one (file descriptor + watch) with each run and don't close it?
I'm using Windows 7 Pro and I made a C# program that makes Speech Recognition.
When I run the program, the Speech Recognition App initializes.
Now, how can I turn it on ("Listen to everything I say") and minimize it (so it goes to systems tray and isn't visible), using C# or Python?
Is there any difference between:
if foo is None: pass
and
if foo == None: pass
The convention that I've seen in most Python code (and the code I myself write) is the former, but I recently came across code which uses the latter. None is an instance (and the only instance, IIRC) of NoneType, so it shouldn't matter, right? Are there any circumstances in which it might?
When it comes to TTS (text-to-speech) libraries in Linux, what choices do developers have?
What libraries ship with the majority of distros?
Are there minimal libraries? What functionality does each library offer?
I'm approaching this primarily from a C++ point of view, although Python would suit me too.
I'm aware that there are modules that fully simplify this function, but saying that I am running from a base install of python (standard modules only), how would I extract the following:
I have a list. This list is the contents, line by line, of a webpage. Here is a mock up list (unformatted) for informative purposes:
<script>
link = "/scripts/playlists/1/" + a.id + "/0-5417069212.asx";
<script>
"<a href="/apps/audio/?feedId=11065"><span class="px13">Eastern Metro Area Fire</span>"
From the above string, I need the following extracted. The feedId (11065), which is incidentally a.id in the code above., "/scripts/playlists/1/" and "/0-5417069212.asx". Remembering that each of these lines is just contents from objects in a list, how would I go about extracting that data?
Here is the full list:
contents = urllib2.urlopen("http://www.radioreference.com/apps/audio/?ctid=5586")
Pseudo:
from urllib2 import urlopen as getpage
page_contents = getpage("http://www.radioreference.com/apps/audio/?ctid=5586")
feedID = % in (page_contents.search() for "/apps/audio/?feedId=%")
titleID = % in (page_contents.search() for "<span class="px13">%</span>")
playlistID = % in (page_contents.search() for "link = "%" + a.id + "*.asx";")
asxID = * in (page_contents.search() for "link = "*" + a.id + "%.asx";")
streamURL = "http://www.radioreference.com/" + playlistID + feedID + asxID + ".asx"
I plan to format it as such that streamURL should = :
http://www.radioreference.com/scripts/playlists/1/11065/0-5417067072.asx
Hello,
I used use Google’s slick interface to get my mail and It’s always going to be here:
https://mail.google.com/a/yourdomainhere.com
I want to write python script that send mail so i failed to configure server settings
smtp = smtplib.SMTP('what is mail server will be?', what is the port)
smtp.login('[email protected]', 'pass')
Please could any one help me ??
Thanks
In python zip function accepts arbitrary number of lists and zips them together.
>>> l1 = [1,2,3]
>>> l2 = [5,6,7]
>>> l3 = [7,4,8]
>>> zip(l1,l2,l3)
[(1, 5, 7), (2, 6, 4), (3, 7, 8)]
>>>
How can I zip together multiple lists in haskell?
Dear all,
I need to generate a vector of random float numbers between [0,1] such
that their sum equals 1 and that are distributed non-uniformly.
Is there any python function that generates such a vector?
Best wishes
I want to print that the all possibilities of a number that occurs interchanging the digits in a number?
I want to print that the all possibilities of a number that occurs interchanging the digits in a number?
Suppose a number 1234 it have 24 possibilities 4!=24
123 have 6 possibilities 3!=6
123
132
213
231
312
321
i want these numbers as output
please tell me the structure of this program in the python