4,305 Posted Topics
Re: Maybe a module like xlrd might do it. https://pypi.python.org/pypi/xlrd | |
Re: You can claim, but the rub is that you have to be willing to defend your claim in a court of law at great expense. | |
Re: [code]s = "abcdefg\n" print s print '-'*10 # strip off trailing '\n' char s = s.rstrip('\n') print s print '-'*10 [/code] | |
Re: If your program is any good, then sooner or later someone will simply write a better program without reverse engineering. | |
Re: Some posters are rude because they don't know any better. For instance they grew up in a home/society where everything was handed to them. My solution, give them an answer that needs work. | |
Re: Actually, the chicken came first then the egg. | |
Re: Python function int() will do this for you ... hx = "FFFF" # convert hexadecimal string hx to a denary (base 10) number n = int(hx, 16) print(n) # 65535 | |
The Swift computer language is the brainchild of a number of Apple associates. In my humble opinion it shows some nice features, but also some warts. Part 1 (constants, variables, strings, tuples, arrays) explores a number of the features to give you a taste of the language. I hope I … | |
Re: One of the many ways ... table =[ ["_","_","_"], ["_","_","_"], ["_","_","_"] ] header = [1, 2, 3] sf = "{} {} {}" print(sf.format(*header)) for line in table: print(sf.format(*line)) | |
Re: You have quite a few errors in your code. Line 16 needs a " Line 27 replace o with 0 Line 32 replace ! with 1 To see what's going on use a few temporary test prints. | |
Re: Let's all take a selfie as we park in the driveway and drive on the parkway. | |
Re: I simply share my photos via email. | |
Re: Write a program that gives the weekday you were born. Write a program that tells you many days old you are. Write a program that lists the date of the third Wednesday of the month for the whole year. Write a program that gives the difference in days between two … | |
Re: A further look at the memory locations ... >>> a = 10.1 >>> b = 10.1 >>> a is b False >>> c = 10.1; d = 10.1 >>> c is d True >>> id(a) 4298630584 >>> id(b) 4298631760 >>> id(c) 4298630704 >>> id(d) 4298630704 >>> `c = 10.1; d … | |
The recent flood of "technical problems" with computers at Delta Airlines, the New York Stock Exchange, the Wall Street Journal etc. make me wonder if we have become too dependent on these machines? Are they maintained by less and less competent people? Has the complexity exceeded human comprehension? | |
Re: It would only go away if "something" better came along. Maybe finally "something" the hackers couldn't abuse at will. I just got a letter from the UCLA hospital that their database got hacked/stolen with all their patients (present and past) private information on it! I could do without this grap! | |
What are the natural disasters that you have to learn to live with in your area? I just moved from the Las Vegas area where we had to live with drought, very high summer temperatures (up to 45 degree C) and the occasional smoke of a far away wildfire. The … | |
Frank Gifford, America's most beloved sports entertainer has passed away in an untimely manner. A great loss for the country and the world. | |
Part 2 of exploring/tasting the Swift language takes a look at dictionaries; process flow controls like loops, if/else and switch/case; functions and sorting. I hope I can follow this up with part 3, a closer look at class operations. | |
Re: Here is one example that explains a little about self and class instance and method: [code=python]# a typical Python class example # newer class convention uses inheritance place holder (object) class Account(object): # __init__() initializes a newly created class instance, # 'self' refers to the particular class instance # and … | |
Re: You can pay DropBox a few extra bucks to add some capacity. That is the idea to get you started for free. Google, MS and Apple all do this. A totally free service will not survive on the long run. | |
In part 4 of tasting Swift, we explore structures. Swift has added some interesting features to structures like defaults, methods, multiple init(). This way struct objects come close to class objects with a little less overhead. As an option, methods can be added externally too. Take a look! Down the … | |
Re: In the Windows world Swift/Xcode would have to compete with the combination of C# and Visual Studio, that might be too much of an obstacle. You can test drive Swift on Windows using the playground at http://swiftstub.com | |
This is the updated version of the Tiny Tkinter Calculator. It has more power, since you can type in functions contained in the Python math module then press the equals key. You can then move the result into memory for other calculations. The code is written in OOP class style … | |
Re: Looking at the zoo in the USA of who is running for president, I would say design a computer program that allows people to elect good leadership from a good choice of candidates. | |
Like most modern languages Swift has sets and set operations. Here is a quick look. Coming in the fall of 2015 ... Swift2 replaces println() with just print() that has a newline default. The sort of thing that Python3 did to print(). There are some other syntax changes. Good news, … | |
Re: FYI ... # get your current locale encoding import locale print(locale.getpreferredencoding(False)) # eg. US-ASCII As of Python 3.4.3 these are the options with open() ... open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) I you use a default encoding of None, then your current locale ancoding is applied. Also your … | |
Re: You could also look at this posting ... https://www.daniweb.com/software-development/python/code/498083/create-a-random-password-python | |
The example shows how to establish a dictionary of (row, column):value pairs to mimic a two dimensional array. This can be easily expanded to more dimensions. Python3 has dictionary comprehension, making the process of creating a dictionary of this type easier. | |
The idea of this thread is to help the beginning Python programmer with hints and helpful code. Please feel free to contribute! If you have any questions start your own thread! The creators of Python are very active, improving the language all the time. Here is a little of the … | |
Just a simple password creator using Python code. The length of the password can be set and the characterset could be changed if you so desire. | |
Re: I remember some C compilers that created assembly code first and then went on to object code and then added an executable stub. That allowed you to add assembly code directly to the C code. Python compiles to a byte code (looks somewhat like assembly code), that is then interpreted. … | |
After you got the basics of Python under your belt, the best way to get a good knowledge of the language and improve your coding skills is to start on a project you are interested in. Maybe an image viewer, a slide show, computer generated random or fractal art, a … | |
Re: Swaroop C.H. has rewritten his excellent beginning Python tutorial for Python3: [url]http://www.swaroopch.com/notes/Python_en:Table_of_Contents[/url] "Dive Into Python" Mark Pilgrim's Free online book, novice to pro, is updated constantly, and has been rewritten for Python3 [url]http://diveintopython3.org/[/url] check appendix A for Py2-to-Py3 differences: [url]http://diveintopython3.org/porting-code-to-python-3-with-2to3.html[/url] | |
Re: In Python range() will do the work for you, no reason to go back to the medieval times. Even the newer curly brace languages have gone to on "in range" iterative approach. | |
This is a test to get the Python snippets going! For those of you who are scared of snakes, the language is named after the TV program, not the snake. Python is an interpreted language, but programs to compile/combine the code to an exe file are available (Py2Exe). The latest … | |
Re: If you create a list or dictionary object in Python, you are really creating an instance of a class. Class instances are reference types. You can test that out on a class you write yourself. | |
Re: It depends on the computer language you are using. You can specify the size of an integer (16, 32, 64 bits). Also your characters nowadays are unicode and take up more than 1 byte. | |
Re: I assume the question is: [B]Who is foolish enough to do my homework for me?[/B] | |
Just wondering. Exploring Google's Go language, a modern day C with the Google in it. | |
Part 3 of the taste of Swift explores class objects in Apple's Swift language. A class allows you to group methods (class functions) together that belong together. Class Person groups some information of people working in an office. Class Pay inherits class Person and adds pay information. Class File groups … | |
Ever since I got a fancy iMac and started using the Xcode IDE, I got hooked on Apple's new Swift language. From what I heard, it is supposed to replace the aging Objective C. I left a couple of Swift code snippets in the Computer Science section about my one-month … | |
Re: At first glance it is a problem with indentation in your function. Move the return out of the for loop. | |
Re: If you mean your hard drive: 1) you can delete all the data and still leave the format 2) formatting will not only remove all data, but also the old format | |
Re: Rather than parallel arrays I would use an array of tuples, this way there is some connectivity during sorting. | |
Re: This might shed a little light on it ... a = 5; cout << a << " " << ++a << " " << ++a << '\n'; | |
Re: This is a tough piece of homework! As a hint, I used something like this ... for ix, line in enumerate(textList): # change to lower case and strip newline char # then create a list of words for each line wordList = line.lower().strip().split() print(wordList) # test for word in wordList: … |
The End.