I'm making a simple application in Pythonista to display webpages, listed in a text file, inside of a webview. I have looked over the documentation and tried to Google this error, but I can't seem to find anything.
Here's my code:
# coding: utf-8
import ui
import urllib2
import re
v = ui.load_view()
v.present('sheet')
webview = ui.WebView
def main():
fx = open('sites.txt', 'r')
lines = fx.readlines()
fx.close()
link1 = re.split('/\n', lines[0])
link1.pop()
link2 = re.split('/\n', lines[1])
link2.pop()
link3 = re.split('/\n', lines[2])
link3.pop()
webview.load_url(link1)
webview.present()
main()
Here is a version of the error I get. Even when I supply a argument in the webview.load_url() method, it says it needs a URL instead of a string. So what I need to know is how to convert a list with one element into something that webview.load_url() will understand.