15,175 Topics

Member Avatar for
Member Avatar for vegaseat

With just about everybody snooping around your emails today with the excuse of hunting the bad guys, coding to keep some resemblance of privacy is getting important. I will start out with some simple encryption examples to get this started. You are invited to give us your thoughts and codes. …

Member Avatar for Lardmeister
3
1K
Member Avatar for Niloofar24

Hi friends! I'm coding a program; i have a Tkinter window with a view button and i can add names with entry box and add button into a list that will be saved on a db file. Now i want the program to show the list names otomaticly when the …

Member Avatar for Niloofar24
0
257
Member Avatar for Niloofar24

Hello! My this time question is about breaking a list. I have a list with the name favorite_movies. Here is 2 functions of all functions from the file: def add(): load_favorite() favorite_movies.append(ent.get()) dump_favorite() #print (colors) def view(): load_favorite() from Tkinter import * v = Tk() v.geometry('300x300') v.configure(background = 'white') top …

Member Avatar for Niloofar24
0
563
Member Avatar for Niloofar24

Hi everybody. How can i creat e text file to use as a database in python? I want to save my project's data changes into hard disk. What should i do?

Member Avatar for snippsat
0
5K
Member Avatar for fonzali

hi , I am trying to write " hi " in persian using unicodes like this : print('\uFEB3\uFEFC\uFEE1') but it prints from the left side and in reverse order like " ih " ( in persian or farsi language we write from right to left ) how can I fix …

Member Avatar for fonzali
0
717
Member Avatar for Niloofar24

Hello friends :) This is my code: #!/usr/bin/env python3 # -*-coding: utf8-*- def callback(): lbl.configure(text = 'button clicked!') import Tkinter window = Tkinter.Tk() window.geometry('300x300') window.configure(background = 'PeachPuff3') lbl = Tkinter.Label(window, text = 'Nothing yet!') btn = Tkinter.Button(window, text = 'add', command = callback).pack() window.mainloop() Why it doesn't work?

Member Avatar for Niloofar24
0
10K
Member Avatar for marcelocent

The script keep closing after the info gets copied to the clipboard. How can I prevent this to happen? import sys import Tkinter from string import * def Load_WordList(): wordList = open("wordlist.txt", "r") wStr = wordList.read() wList = split(wStr,"\n") return wList def compare(x,y): x1=0 x2=0 y1= [] y2= [] j …

Member Avatar for glenn_3
0
281
Member Avatar for marcelocent

## solution 1: fast enough response, simple function, fail fast from time import clock def isanaword(k,s): """ goes through the letters of second word (s) and returns it if first word (k) contains exactly same letters in same number """ for c in s: pos = k.find(c) if pos==-1: return …

Member Avatar for vegaseat
0
250
Member Avatar for ben.juarez.773

Hello, I'm working on a small project to acquire information from regulations.gov using their API. It's fairly simple (codewise) what I'm trying to do. However, I get stuck with a "HTTP error 403: Forbidden". It means I'm connecting, but something seems to be the matter. I've been in contact with …

Member Avatar for richieking
0
518
Member Avatar for Niloofar24

Hi everybody! How can i call a function from Tkinter without using Buttons? I have a test.py file and there is a function def message in it: def message(): print('Good morning') from Tkinter import * tk = Tk() tk.mainloop() I want to type test.py message from linux terminal and the …

Member Avatar for sneekula
0
11K
Member Avatar for Niloofar24

Hello everybody! Me again with an other question :) I have a file with a list and 3 functions in it; view, sort, append. I used pickle to save data changes in to an other file (films.db). Imagine you want to use this programe for the first time on your …

Member Avatar for Niloofar24
0
2K
Member Avatar for vegaseat

Knowing the longitude and latitude coordinates of two cities you can calculate the distance between them. Use the code in https://www.daniweb.com/software-development/python/code/490561/postal-code-zips-and-location-python to find the coordinates.

3
2K
Member Avatar for vegaseat

Using http://download.geonames.org/export/zip/ you can get postal information for most countries in the world. The raw data string can be transformed into a Python list of lists that can be searched for zip codes, locations, longitude and latitude coordinates.

2
4K
Member Avatar for kouty

Hello friends. I want to create a list of sublists E.G. i = 0 pack = [] list = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] while i < 17: sublist = list[list[i]: list [i + 3]] pack = pack + sublist i += 1 print (pack) the output is: Type "copyright", "credits" or "license()" for …

Member Avatar for sneekula
0
203
Member Avatar for snippsat

A look at [Dataset](http://dataset.readthedocs.org/en/latest/) and easy and Pythonic way to create a database. Other candidates in this categorie,i will mention [pyDAL](https://github.com/web2py/pydal) and [Peewee](https://peewee.readthedocs.org/en/latest/). I did some test of Dataset in this [post](https://www.daniweb.com/software-development/python/threads/490219/how-can-i-creat-e-text-file-to-use-as-a-database-in-python) to look at. So here a common task some web-scraping of food recipes(just a task i did help …

3
291
Member Avatar for kouty

Hello Daniweb! I learn in the Computer Sciences Circle, [Click Here](http://cscircles.cemc.uwaterloo.ca/) in the chapter 8. there strings, for exemple "sse" and "assessement" or "an" and "trans-panamian bananas", and we just need to count the occurences of thr furst in the second. My wrong code is """ Cet exercice consiste a …

Member Avatar for Gribouillis
0
406
Member Avatar for bahubali.mangave.9

hey guys i have written progam from sys import argv script, user_name = argv prompt = '> ' print "Hi %s, I'm the %s script." % (user_name, script) print "I'd like to ask you a few questions." print "Do you like me %s?" % user_name likes = raw_input(prompt) print "Where …

Member Avatar for woooee
0
159
Member Avatar for Niloofar24

Hello! I have a file with a list and 3 functions in it; view, append and sort functions. I want to use pickle to save data changes in to another file inorder to retrive it next time. I have a list, when i call function VIEW, i see the primary …

Member Avatar for sneekula
0
176
Member Avatar for Gribouillis

I uploaded a module named [symboldict](https://pypi.python.org/pypi/symboldict) to the python package index (pypi). This snippet shows how to use it to create a dictionary of symbols from various modules. This dictionary can be used as a common language shared by several modules. It can be used to load python libraries in …

Member Avatar for Gribouillis
4
518
Member Avatar for vegaseat

Using the Python win32 extensions it is relatively simple to copy to and from the clipboard. Sorry. the Windows OS is a requirement.

0
2K
Member Avatar for vegaseat

Just a small mildly optimized function to check if an integer is a prime number. For very large numbers use the Miller-Rabin primality test. There have been questions why I used `not n & 1` to check for even integer n. The more tradional` n % 2 == 0` is …

Member Avatar for vegaseat
2
3K
Member Avatar for sneekula

You can accesss the clipboard simply by using the Tkinter GUI toolkit that comes with your Python installation.

Member Avatar for TrustyTony
1
14K
Member Avatar for shafter111

Hi.....I am a newbie...really confused with do while loop in python. Does it even exist? [CODE] J=[] do: finished = "false" while finished != "true": finished="true" for j in xrange(len(lis2)): cenP2 = G[i+G0] if ((cenP2 == 0) & (sigma2 > 0) J.append(1) finished = "false" print 3 # test code …

Member Avatar for sneekula
0
31K
Member Avatar for nugnug1616

This sort of works but my tkinter window kees freezing. heres my code: import pygame, sys, time, random#Imports the modules pygame, sys, time and random form the python libary from pygame.locals import *#Imports all of the pygame modules global randomNumber #randomNumber = random.randint(1,4) redandBlackCounters = [120, 735, 250, 735, 560, …

Member Avatar for TrustyTony
0
446
Member Avatar for vegaseat

A dictionary in Python is an unordered set of key:value pairs. I show you how to initialize, create, load, display, search, copy and otherwise manipulate this interesting container. Like the name says, it is the closest thing to a dictionary.

Member Avatar for Babe1
3
1K
Member Avatar for vegaseat
Member Avatar for throwaway123

I need help with this program I am doing. I need to be able to select encrypt or decrypt(ive only done encrypt at the momment) and need to be able to select an offset here what ive got so far and I have a number of problems. http://imgur.com/a/N3Tul 1 is …

Member Avatar for vegaseat
0
338
Member Avatar for Shaji_1

I am trying to change the first character of each word in a list to upper case using Python 2.7. I am able to change the entire list to lower case, but I am not getting what I want - i.e the first character of each word to be upper …

Member Avatar for TrustyTony
0
306
Member Avatar for Niloofar24

Hi everybody. I've created a .py file with a simple function in it. Now i want to call that function from linux shell scripting. How should i do that? please help me, thank you.

Member Avatar for Niloofar24
0
1K
Member Avatar for kouty

Hi to the forum; A simple question: I want to make a prime number checker: So if I want to test if 25 is a prime number. i should to verify if 2 is a factor. if it is not, i verify with 3 and 4 (not my subject if …

Member Avatar for kouty
0
186

The End.