i have (one column) list called test in r. when view in r this: > test value 569 n 1012 y 4279 n 7588 n 3434 n 2408 y 1958 y 1251 y how reference "row name"? i.e. 569, 1012, 4279 etc. i want find example value @ "row" 1012 (which "y" here). i've tried using test[1], test[,1] etc. first column isn't column. don't know is. makes kind of sense. don't know find solution this. if test is data frame; txt <- " value 569 n 1012 y 4279 n 7588 n 3434 n 2408 y 1958 y 1251 y " test <- read.table(textconnection(txt), header = true) then, > test["1012", ] [1] y levels: n y will extract required row.
greetings by using pymssql library, want write data mssql database encounter encoding issues. here sample code write db: # -*- coding: utf-8 -*- import _mssql .... connection info data here .... def mssql_connect(): return _mssql.connect(server=host, user=username, password=pass, database=db, charset="utf-8") con = mssql_connect() insert_ex_sql = "insert mydatabsae (id, programname, programdetail) values (1, 'test characters ÜŞiçÇÖö', 'löşüiiğĞü');" con.execute_non_query(insert_ex_sql) con.close() sadly data written db corrupted: the collacation of mssql db is: turkish_ci_as how can solved? here possible solution : the key insert_ex_sq.encode('your language encoder') . try instead: con.execute_non_query(insert_ex_sq.encode('your language encoder'))
what regex find text#2? pattern it's first occurance of "z=" after c. text want rest of line after z=. i'm using regex in .net a x b x z=text#1 x c x z=text#2 .*c.*z=([^\n]*).* you'll need turn on . matching newlines ( regexoptions.singleline below). here's c# code generated my regex tester : using system; using system.text.regularexpressions; namespace myapp { class class1 { static void main(string[] args) { string sourcestring = "source string match pattern"; regex re = new regex(@".*c.*z=([^\n]*).*",regexoptions.singleline); matchcollection mc = re.matches(sourcestring); int midx=0; foreach (match m in mc) { (int gidx = 0; gidx < m.groups.count; gidx++) { console.writeline("[{0}][{1}] = {2}", midx, re.getgroupnames()[gidx], m.groups[gidx].value); } ...
Comments
Post a Comment