Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 420 results for
itertools
- Page 1
Evaluating OpenAI GPT 4.1 for Text Summarization and Classification Tasks
Programming
Computer Science
2 Weeks Ago
by usmanmalik57
… import matplotlib.pyplot as plt import seaborn as sns from
itertools
import combinations from collections import Counter from sklearn.metrics import…
Itertools Combinations
Programming
Software Development
12 Years Ago
by flebber
…-for-the-python-beginner/ In there was this example from
itertools
import combinations teams = ["Packers", "49ers", "… bigger list and a bigger tuple. >>> from
itertools
import combinations >>> numbers = [1,2,3,4…
Re: Itertools Combinations
Programming
Software Development
12 Years Ago
by vegaseat
…) or use the list(combinations()) approach (shown by Griboullis) ... from
itertools
import combinations numbers = [1,2,3,4,5,6,7…
Array of Arrays for itertools.product?
Programming
Software Development
15 Years Ago
by mattloto
Thanks to another post of mine, I found out about
itertools
.product(). What I was wondering how to do is to … this: [CODE]array=[['a','b'],['b','c'],['c','a']] z=
itertools
.product(x for x in array)[/CODE] but that didnt…
Re: Array of Arrays for itertools.product?
Programming
Software Development
15 Years Ago
by Gribouillis
You can use [icode]
itertools
.product(*array)[/icode], also if your want your result in a list, you write [icode]list(
itertools
.product(*array))[/icode].
python hashlib with itertools ... what is happening with strings?
Programming
Software Development
12 Years Ago
by memomk
… we have this code import hashlib,
itertools
,string m=hashlib.md5() s=string.printable it=
itertools
.product(s,repeat=1) for i…
Sugar above the itertools module.
Programming
Software Development
12 Years Ago
by Gribouillis
This python 2.7 snippet adds a thin layer of sugar on the
itertools
module's api, allowing many of its functions to be used as decorators and adding some new functions. Enjoy !
Re: Itertools Combinations
Programming
Software Development
12 Years Ago
by Gribouillis
Use `len(list(combinations(numbers, 6)))`
Re: Itertools Combinations
Programming
Software Development
12 Years Ago
by flebber
Ok, hmmm so you can't get the information from 'game' directly have to call Len on the combinations function.
Re: Itertools Combinations
Programming
Software Development
12 Years Ago
by flebber
So its all because combinations doesn't group its tuples into a main tuple. Otherwise it would work. >>> myTup = ((1,2),(2,3),(3,4)) >>> len(myTup) 3
Re: Itertools Combinations
Programming
Software Development
12 Years Ago
by Lucaci Andrew
> Ok, hmmm so you can't get the information from 'game' directly have to call Len on the combinations function. You don't call len on the combination function, you call len on the list function, which returns a list with all the combinations. To make it more clear `len(list(combinations(numbers, 6)))` is like this: >>> numbers = …
Re: Itertools Combinations
Programming
Software Development
12 Years Ago
by bumsfeld
You need to check the effects of sample size.
Re: Array of Arrays for itertools.product?
Programming
Software Development
15 Years Ago
by vegaseat
Using your example list [B]array=[['a','b'],['b','c'],['c','a']][/B] what do you expect the result to look like?
Re: python hashlib with itertools ... what is happening with strings?
Programming
Software Development
12 Years Ago
by TrustyTony
You have only a in second case, but all letters before it also in first case. >hash.update(arg) > Update the hash object with the string arg. Repeated calls are equivalent to a single call with the concatenation of all the arguments: m.update(a); m.update(b) is equivalent to m.update(a+b). import hashlib, string for i in string.…
Re: python hashlib with itertools ... what is happening with strings?
Programming
Software Development
12 Years Ago
by memomk
hmm i thought update() function will delete the value and set a new one .. thanx .. sloved..
Re: Sugar above the itertools module.
Programming
Software Development
12 Years Ago
by rubik-pypol
Very interesting! Thanks for sharing! Is it on PyPI?
Re: Sugar above the itertools module.
Programming
Software Development
12 Years Ago
by Gribouillis
> Is it on PyPI? No, it is exclusively on daniweb. If there are comments and improvements, it may go to pypi someday ... :)
Re: Generating All possible Combination
Programming
Software Development
13 Years Ago
by snippsat
… pprint letters = ['A', 'B', 'C'] pprint.pprint(list(
itertools
.product(letters, repeat=3))) """Output--> [('A', '…
Pyqt my program GUI freeze when starting a process
Programming
Software Development
13 Years Ago
by memomk
…self): import anydbm import string import hashlib from
itertools
import product from multiprocessing import Process t1=Process…t2.join() def g1(self): import hashlib from
itertools
import product import anydbm import string str=string.…
Program has stopped working with advent of a PyQt GUI. Seeking advice.
Programming
Software Development
15 Years Ago
by Stev0
…1 import urllib import urllib.request import sys import
itertools
import time from PyQt4 import QtCore, QtGui from robo_ui…(max)+1)) else: ip_parts.append([int(part)]) ip_addresses =
itertools
.product(*ip_parts) for ip_addy in ip_addresses: self.ui.textBrowser.append…
Re: Quest for most stupid Sudoku solver
Programming
Software Development
14 Years Ago
by TrustyTony
…;" from __future__ import print_function import time import
itertools
import pretty numbers = set('123456789') FAIL_LIMIT = 2500… to be python3 compatible (see the manual for
itertools
version) def grouper(n, iterable): return zip(*((…)==1 else '.' for value in s] return
itertools
.takewhile(lambda x: x, (''.join(sorted(remaining_neighbours…
Re: Pyqt my program GUI freeze when starting a process
Programming
Software Development
13 Years Ago
by memomk
… # -*- coding: utf-8 -*- import anydbm import string import hashlib from
itertools
import product from multiprocessing import Process from PyQt4 import QtCore…
Re: Pyqt my program GUI freeze when starting a process
Programming
Software Development
13 Years Ago
by memomk
… # -*- coding: utf-8 -*- import dbm import string import hashlib from
itertools
import product from multiprocessing import Process from threading import Thread…
Iterating over large number of files
Programming
Software Development
15 Years Ago
by Xydric
…/bin/python #Import needed modules. import re import os import
itertools
vars = {} #Regex compile - list of file extensions and regexes r… = ( os.path.join(dir,file) for (dir, subdirs, files) in
itertools
.chain(*generators) for file in files if r.search(file…
How do you repeat a function from a definition?
Programming
Software Development
14 Years Ago
by dustbunny000
[ICODE]import random import
itertools
def test(number): return random.random()*number [/ICODE] Say I … deviation. How can I do this? I've tried using
itertools
.repeat(test(5),3) but it prints repeat(value,3…
Permutations in Python3
Programming
Software Development
14 Years Ago
by king_koder
I tried to generate permutations by using
itertools
module but its not working. [CODE=python] >>>print(permutations([1,2,3],3)) <
itertools
.permutations object at 0xa917c5c> [/CODE] Why is it so? and how do I make it work properly?
Re: Quest for most stupid Sudoku solver
Programming
Software Development
14 Years Ago
by TrustyTony
…. [CODE]from __future__ import print_function import time import
itertools
import sys import pretty numbers=set('123456789') FAIL_LIMIT =…27)) and all(correct(gr) for gr in
itertools
.chain(grouper(9, s), (s[start::9]…value)==1 else '.' for value in s] return
itertools
.takewhile(lambda x: x, (''.join(sorted(remaining_neighbours(s…
Vertical Histogram with Built-In Modules Only
Programming
Software Development
14 Years Ago
by joeywheels
… lost on how to create a vertical histogram. [CODE]import
itertools
def histogram(s): print("Histogram:") print("%s…(word) word_list.append(word_count) word_list.sort() for key, iter in
itertools
.groupby(word_list): word_seq.append((key, len(list(iter)))) histogram(word_seq…
Re: Vertical Histogram with Built-In Modules Only
Programming
Software Development
14 Years Ago
by joeywheels
… posting the length and count before the histogram. [CODE]import
itertools
def histogram(s): tuple_dict = {} for i in sorted(s.values…(word) word_list.append(word_count) word_list.sort() for key, iter in
itertools
.groupby(word_list): word_seq.append((key, len(list(iter)))) print("…
Re: Vertical Histogram with Built-In Modules Only
Programming
Software Development
14 Years Ago
by joeywheels
… am calling a file in the actual version. [CODE]import
itertools
def histo(dict_words): x_max = max(dict_words.keys()) y_max = max(dict_words…(word) word_list.append(word_count) word_list.sort() for key, iter in
itertools
.groupby(word_list): word_seq.append((key, len(list(iter)))) print("…
1
2
3
7
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC