Posts
 
Reputation
Joined
Last Seen
Ranked #74
Strength to Increase Rep
+14
Strength to Decrease Rep
-3
96% Quality Score
Upvotes Received
469
Posts with Upvotes
366
Upvoting Members
148
Downvotes Received
17
Posts with Downvotes
14
Downvoting Members
10
85 Commented Posts
Member Avatar for fonzali

To make some futher i improvement's. All code is now in functions, explanation is moved into function so it work as doc-string(then it's possible to use `help()` on functions). I have removed all `global` statement which it's not good at all. Functions should be isolated code,that takes argument's and return …

Member Avatar for Thati
0
5K
Member Avatar for joe82

Hi see if this help you. [CODE]>>> str_input = '''AATTCCGGTTT CCTTAACCCCC''' >>> str_input 'AATTCCGGTTT\nCCTTAACCCCC' >>> x = str_input.replace ('\n', '') >>> x 'AATTCCGGTTTCCTTAACCCCC' >>> [/CODE]

Member Avatar for vishakha_3
0
22K
Member Avatar for pwolf

[QUOTE]but it says its not right, whats wrong with it?[/QUOTE] The code works,python always give you Traceback. Post Traceback next time. Run of code. [CODE]>>> generateNumber(0,10,2) [0, 2, 4, 6, 8, 10] >>> generateNumber(20,0,-3) [20, 17, 14, 11, 8, 5, 2] >>> [/CODE]

Member Avatar for Reverend Jim
1
1K
Member Avatar for macroasm

This was very bad,not worth anyone times. The gui builder for wxpython could be better,but they are much better than this.

Member Avatar for Titus_1
-4
2K
Member Avatar for novice20

Dont use bold character for everthing. Here is and example you can look at and try out. [CODE]#average.py #saved in python dir from __future__ import division def average(seq_in): if isinstance(seq_in, (list, tuple)): return sum(seq_in) / len(seq_in) else: return 'Input can only be list or tuple' [/CODE] So we save this …

Member Avatar for Cisco_1
0
37K
Member Avatar for r3bol

You are doing some strange stuff. Do you get urllib to work for this site? import urllib2 url = "http://www.blah.fi/" read_url = urllib2.urlopen(url).read() print read_url #403 error This site are blocking use of urllib. I had to use [Requests](http://docs.python-requests.org/en/latest/) to get source code. You can use BeautifulSoup to get all …

Member Avatar for happygeek
0
6K
Member Avatar for shibunath

You dont need to convert code just write it in python. I could of course convert it to look exactly like C++ over,but that had been stupid. Because python dos most stuff a lot eaiser than C/C++. [CODE] print 'Enter numers,use q to stop' l = [] while True: user_input …

Member Avatar for Zak_2
0
6K
Member Avatar for Fo.katia

You have some mistake,and use code tag. See if this help. [CODE]def main(): phrase = input("Enter a sentence:") words = phrase.split() #Forget () wordCount = len(words) print("The total word count is: %s" % wordCount) #You have to include wordCount in print main()[/CODE]

Member Avatar for woooee
0
13K
Member Avatar for ihatehippies

Something like this? import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize) #--Panel so it look good on all platforms self.panel = wx.Panel(self) self.datepick = wx.DatePickerCtrl(self.panel,-1, pos=(20,15), style=wx.DP_DROPDOWN|wx.DP_SHOWCENTURY) self.datepick.Bind(wx.EVT_DATE_CHANGED, self.onAction) self.label = wx.StaticText(self.panel,-1,"", pos=(20,50)) def onAction(self, event): '''Process data from picked date''' selected = self.datepick.GetValue() …

Member Avatar for gdtraveller
0
2K
Member Avatar for otengkwaku

I have done some tesing and got it to work(windows 7 Ultimate) First my test code. #sound_test.py import pyttsx import time from datetime import date from datetime import datetime engine = pyttsx.init() date = date.today() time_now = datetime.now() date = date.strftime("%A %d %B") time_now = time_now.strftime('%H:%M:%S') engine.say('The date is {} …

Member Avatar for Thomas Karl
0
2K
Member Avatar for HoneyBadger

[CODE]import wx class my_window(wx.Frame): def __init__(self, parent, id): #error __int__ wx.Frame.__init__(self,parent,id,'My Window', size=(300,200)) #Panel for frame self.panel = wx.Panel(self) self.SetBackgroundColour('blue') if __name__ == "__main__": app=wx.PySimpleApp() frame=my_window(parent=None,id=-1) frame.Show() app.MainLoop()[/CODE]

Member Avatar for Rufus_1
0
11K
Member Avatar for sudipta.mml

As posted by @dashing.adamhughes there are made a lot of stuff that can help you with this,another eksp is [pyfasta](http://pypi.python.org/pypi/pyfasta/) > How to get the start and end position of a particular pattern You can use `re.finditer` for this. >>> import re >>> s = '11ATGC1111ATGC11111ATGC' >>> p = 'ATGC' …

Member Avatar for Matej_1
0
344
Member Avatar for john_beginner

Look like you use python 3 [CODE]>>> #Python3 has only input that return a string >>> user_input = input('Give me a number: ') Give me a number: 10 >>> user_input '10' >>> type(user_input) <class 'str'> >>> print 'Your number was %s' % (user_input) SyntaxError: invalid syntax (<pyshell#4>, line 1) >>> …

Member Avatar for Reverend Jim
0
21K
Member Avatar for ruwach

[QUOTE]what has fileHandle been replaced with in python 3.1[/QUOTE] FileHandle is just a variable name used by vega. You can use whatever name you want. Here is the same code for python 3 [CODE] # Testet work for python 3 # read a text file as a list of lines …

Member Avatar for gunjan_3
0
63K
Member Avatar for Ruchi224

Start to read where you post,this is the python part of Daniweb. Post in VB forum. [QUOTE] Trying hard since 1 week... Cn u plz provide me a code for d same ??? I got submissions in few days... Pllzzz.... Thanx !![/QUOTE] And nowone post finsih code,if you dont show …

Member Avatar for Schol-R-LEA
-1
200
Member Avatar for tinstaafl

The same for me "InBox" and "Send Message" has not work after change to Dazah. Both give `Rate limit exceeded: Please try your request again in a few minutes.. ` Same on all pc. Has to copy cookie to from working login,to other computer just to get login to work. …

Member Avatar for Dani
1
544
Member Avatar for hpoddar

I see you have get good help from Gribouillis. As a note `with open` was new in python 2.5. python 2.2.1 is really old. Alternatives is to write your own parser that works for your files,it`s not so hard. If i use config file postet by Grib. cfg_dict = {} …

Member Avatar for Anand_10
0
12K
Member Avatar for <HHH>

Use wheel as posted bye Gribouillis. PyMongo has C depencies so to avoid this [Installing from source on Windows](https://api.mongodb.com/python/current/installation.html#installing-from-source-on-windows) Go [here](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymongo),when dowloaded your version. Do e.g **pip install pymongo-3.3.0-cp35-cp35m-win32.whl** Wheel(.whl) has all C depencies packed,no need to compile.

Member Avatar for ~s.o.s~
0
2K
Member Avatar for <HHH>

To set it up more,correct and fix error. Capitale letters in `method == 'POST'` Have remove GET to avoid to confusion. foo\ app.py templates\ index.htm `app.py` from flask import Flask,redirect,url_for,request,render_template app = Flask (__name__) @app.route('/') def my_form(): return render_template("index.html") @app.route('/suc/<name>') def suc(name): return "hello Boss %s" % name @app.route('/login', methods=['POST']) …

Member Avatar for snippsat
0
589
Member Avatar for karthik_6

Your pasting of xml is a mess:) The best is to use [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/bs4/doc/)/lxml. E.g from bs4 import BeautifulSoup xml ='''\ <?xml version="1.0" encoding="UTF-8"?> <note> <to>Hello</to> <from>wold</from> <msg timestamp="20160817 12:46:42.520" level="INFO">Info on CPU</msg> </note>''' #soup = BeautifulSoup(open("your.xml"), 'html.parser') #Read from a file soup = BeautifulSoup(xml, 'html.parser') msg = soup.find('msg') print(msg.text) …

Member Avatar for snippsat
0
632
Member Avatar for lewashby

> I like python and I wanted to give it a try at web programming but the setup and management is too difficult. I'll just go back to php. It's not so difficult,and you do not need stuff like LAMP. Django and Flask has build in web-server this you use …

Member Avatar for lewashby
0
1K
Member Avatar for <HHH>

It's in [http.cookie](https://docs.python.org/3/library/http.cookies.html) for Python 3.x. So import is `from http import cookies` For all about HTTP use [Requests](http://docs.python-requests.org/en/master/) >>> import requests >>> url = 'http://httpbin.org/cookies' >>> cookies = dict(cookies='are good to eat') >>> r = requests.get(url, cookies=cookies) >>> print(r.text) { "cookies": { "cookies": "are good to eat" } }

Member Avatar for <HHH>
0
5K
Member Avatar for Karthik_4

> what if I need to take seperate nosetests html report for each file.. How can I do that ? Yes as bash script looping over files will work,or a Python script with `subprocess`. There are build into nose to test all files that start `test`. So naming your files …

Member Avatar for Karthik_4
0
13K
Member Avatar for pirulo64

Command you has to be string and you concatenate "line" inside `os.system()`. So if i have i list of words and want to now lenght of each word, i can use linux command `expr length`. The command get executed on each line of words.txt. import os import time f = …

Member Avatar for pirulo64
0
277
Member Avatar for mattrweaver

The problem can be solved before give data to Pandas. As mention over there are lot of cases to think about. I would have made up rules with regex. Example. >>> import re >>> s = "Richard Wayne Van Dyke" >>> re.split(r"\s*(?:(?:[a-zA-Z]')|(Van \w.*))", s, re.I)[:-1] ['Richard Wayne', 'Van Dyke'] >>> …

Member Avatar for snippsat
0
3K
Member Avatar for checker

A more normal way to use __int__ (constructor) in a python class. And just some point that a class is storeing variables in a dictionary. [CODE]from math import sqrt class ageName(object): '''class to represent a person''' def __init__(self, name, age): self.name = name self.age = age worker1 = ageName('jon', 40) …

Member Avatar for Gribouillis
0
2K
Member Avatar for arindam31

Just some points,always use raw string [B]r' '[/B] with regex. For email validation re.match(),for extracting re.search, re.findall(). There is no simple soultion for this,diffrent RFC standard set what is a valid email. This has been up in several forum,here is a good one you can read. [url]http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses[/url] Just a quick …

Member Avatar for Syed Sulaiman
3
10K
Member Avatar for bryann

>Is that what gets returned if the letter is not in the dictionary? So if it can't find the letter it adds 0? Yes,and you can also return a more meaningful message. Here in function and return value out. def record(word): return { "t": 1, "f": 1, "c": 1, "b": …

Member Avatar for snippsat
0
260
Member Avatar for westsiderailway

>Beautiful Soup is for python . i am using windows and vb.net You should find a parser for vb.net,like [Html Agility Pack ](http://htmlagilitypack.codeplex.com/) >i have been doing some research. >and found out about Regular expressions..... Regex i bad tool for html,read this funny answer bye [bobince ](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags). >gives me pratice …

Member Avatar for overwraith
0
554
Member Avatar for Dani

I have to say that i don't like this tagging system at all. Maybe it's get better when i get used to it,but i am not sure. In Python part of the old forum we had sticky thread, do we really need to search for those threads now? Or can …

Member Avatar for Nick Evan
2
1K