On Sat, Sep 28, 2013 at 7:33 PM, Νίκος <nikos.gr...@gmail.com> wrote: > It woould be nice if we could write it as: > > > ipval = ( os.environ.get('HTTP_CF_CONNECTING_IP') or > os.environ.get('REMOTE_ADDR', "Cannot Resolve") ) > try: > gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat') > city = gi.time_zone_by_addr( ipval ) > host = socket.gethostbyaddr( ipval ) [0] > except socket.gaierror as e: > if city failed assign to it "Άγνωστη Πόλη" while if host failed > assign it "Άγνωστη Προέλευση" > > but without an if statement and in 1 single line.
[ROLL] Rosuav rolls his eyes: 1, 1, totalling 2. Then split your try blocks! You've already been told this. ChrisA -- https://mail.python.org/mailman/listinfo/python-list