Re: [Tutor] Finding the max value from a dictionary that does not exceed a variable's value.

2016-01-31 Thread srinivas devaki
On Sun, Jan 31, 2016 at 3:54 AM, Danny Yoo wrote: > --- > I want to take the max value in the dictionary 'coinvalues' that is the > same as or lower than the variable 'change'. I have no idea how to search > through the 'coinvalues' dictionary and find the value that is highest but > does not ex

[Tutor] event loop vs threads

2016-09-25 Thread srinivas devaki
the extra overhead for threads come from ? Regards Srinivas Devaki Senior (final yr) student at Indian Institute of Technology (ISM), Dhanbad Computer Science and Engineering Department ph: +91 9491 383 249 telegram_id: @eightnoteight ___ Tutor maillist

[Tutor] Unicode to Ascii

2016-09-26 Thread srinivas devaki
How can I convert Unicode to Ascii by stripping of any non ascii characters. one way is to filter on s like ascii = ''.join(filter(lambda x: 0 <= ord(x) < 256, unicode_string)) but are there any other simple ways ? Regards Srinivas Devaki Senior (final yr) student at Ind

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread srinivas devaki
SQL has "CREATE TABLE IF NOT EXISTS" so you change your instructions to ```python import sqlite3 conn = sqlite3.connect(':memory:') c = conn.cursor() c.execute(""" CREATE TABLE IF NOT EXISTS BloodPressureReadings ( ReadingID INTEGER PRIMARY KEY, Date TEXT, Time TEXT, SystolicBP INT

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread srinivas devaki
had to exported out of sqlite to either mysql or postgresql at which time it would be a lot of refactoring as this trick uses sqlite internals to check if a table exists. fetchone would always return a tuple as we did count in the sql instruction. so it would be easier to embed in an if statement. Reg