diff --git a/networkx/readwrite/edgelist.py b/networkx/readwrite/edgelist.py
index 72afe1a7c..5183071d1 100644
--- a/networkx/readwrite/edgelist.py
+++ b/networkx/readwrite/edgelist.py
@@ -270,7 +270,11 @@ def parse_edgelist(
         elif data is True:
             # no edge types specified
             try:  # try to evaluate as dictionary
-                edgedata = dict(literal_eval(" ".join(d)))
+                if delimiter == ",":
+                    edgedata_str = ",".join(d)
+                else:
+                    edgedata_str = " ".join(d)
+                edgedata = dict(literal_eval(edgedata_str.strip()))
             except BaseException as e:
                 raise TypeError(
                     f"Failed to convert edge data ({d}) " f"to dictionary."

diff --git a/networkx/readwrite/tests/test_edgelist.py b/networkx/readwrite/tests/test_edgelist.py
index 2e1a2424f..31f214566 100644
--- a/networkx/readwrite/tests/test_edgelist.py
+++ b/networkx/readwrite/tests/test_edgelist.py
@@ -100,6 +100,48 @@ class TestEdgelist:
             G.edges(data=True), [(1, 2, {"weight": 2.0}), (2, 3, {"weight": 3.0})]
         )
 
+    def test_read_edgelist_5(self):
+        s = b"""\
+# comment line
+1 2 {'weight':2.0, 'color':'green'}
+# comment line
+2 3 {'weight':3.0, 'color':'red'}
+"""
+        bytesIO = io.BytesIO(s)
+        G = nx.read_edgelist(bytesIO, nodetype=int, data=False)
+        assert_edges_equal(G.edges(), [(1, 2), (2, 3)])
+
+        bytesIO = io.BytesIO(s)
+        G = nx.read_edgelist(bytesIO, nodetype=int, data=True)
+        assert_edges_equal(
+            G.edges(data=True),
+            [
+                (1, 2, {"weight": 2.0, "color": "green"}),
+                (2, 3, {"weight": 3.0, "color": "red"}),
+            ],
+        )
+
+    def test_read_edgelist_6(self):
+        s = b"""\
+# comment line
+1, 2, {'weight':2.0, 'color':'green'}
+# comment line
+2, 3, {'weight':3.0, 'color':'red'}
+"""
+        bytesIO = io.BytesIO(s)
+        G = nx.read_edgelist(bytesIO, nodetype=int, data=False, delimiter=",")
+        assert_edges_equal(G.edges(), [(1, 2), (2, 3)])
+
+        bytesIO = io.BytesIO(s)
+        G = nx.read_edgelist(bytesIO, nodetype=int, data=True, delimiter=",")
+        assert_edges_equal(
+            G.edges(data=True),
+            [
+                (1, 2, {"weight": 2.0, "color": "green"}),
+                (2, 3, {"weight": 3.0, "color": "red"}),
+            ],
+        )
+
     def test_write_edgelist_1(self):
         fh = io.BytesIO()
         G = nx.OrderedGraph()

Parse edgelist bug
When calling `parse_edgelist()` using comma delimiters, it will fail to parse correctly fro edges with multiple attributes.

Ex. of bad edge:
`1,2,{'test':1, 'test_other':2}`

`parse_edgelist()` will recognize the comma in the braces as delimiter and try to split them up.
networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_read_edgelist_6
networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_read_edgelist_1 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_read_edgelist_2 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_read_edgelist_3 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_read_edgelist_4 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_read_edgelist_5 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_write_edgelist_1 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_write_edgelist_2 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_write_edgelist_3 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_write_edgelist_4 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_unicode networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_latin1_issue networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_latin1 networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_edgelist_graph networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_edgelist_digraph networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_edgelist_integers networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_edgelist_multigraph networkx/readwrite/tests/test_edgelist.py::TestEdgelist::test_edgelist_multidigraph