Skip to content

Instantly share code, notes, and snippets.

View Mayank-1234-cmd's full-sized avatar

mayank-1234-cmd Mayank-1234-cmd

View GitHub Profile
@Mayank-1234-cmd
Mayank-1234-cmd / latlongdata.py
Last active February 15, 2021 13:54
latitude and longitude of locations
# extracted from https://developers.google.com/public-data/docs/canonical/countries_csv
countries=[["AD","42.546245","1.601554","Andorra"],["AE","23.424076","53.847818","United Arab Emirates"],["AF","33.93911","67.709953","Afghanistan"],["AG","17.060816","-61.796428","Antigua and Barbuda"],["AI","18.220554","-63.068615","Anguilla"],["AL","41.153332","20.168331","Albania"],["AM","40.069099","45.038189","Armenia"],["AN","12.226079","-69.060087","Netherlands Antilles"],["AO","-11.202692","17.873887","Angola"],["AQ","-75.250973","-0.071389","Antarctica"],["AR","-38.416097","-63.616672","Argentina"],["AS","-14.270972","-170.132217","American Samoa"],["AT","47.516231","14.550072","Austria"],["AU","-25.274398","133.775136","Australia"],["AW","12.52111","-69.968338","Aruba"],["AZ","40.143105","47.576927","Azerbaijan"],["BA","43.915886","17.679076","Bosnia and Herzegovina"],["BB","13.193887","-59.543198","Barbados"],["BD","23.684994","90.356331","Bangladesh"],["BE","50.503887","4.469936","Belgium"],["BF","12.238333","
@Mayank-1234-cmd
Mayank-1234-cmd / os.system (fixed).py
Created March 29, 2021 16:26
os.system but returns str output
import os
def os_system(cmd):
z=str(os.system(cmd))
return z.replace("u'","",1).replace("'","",z.count("'"))
os_system("echo hi")
bytesf=b'bytes string'
bytesf=str(bytesf).replace("b'","",1).replace("'","",str(bytesf).count("'"))
print(bytesf) # returns bytes string